package com.qj.yantaishan.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qj.yantaishan.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import com.qj.yantaishan.mapper.ProductSkuMapper;
import com.qj.yantaishan.domain.ProductSku;
import com.qj.yantaishan.service.IProductSkuService;
import com.qj.yantaishan.common.core.text.Convert;

/**
 * 商品库存Service业务层处理
 * 
 * @author qihe
 * @date 2022-07-22
 */
@Service
@Primary
public class ProductSkuServiceImpl    extends ServiceImpl<ProductSkuMapper, ProductSku>  implements IProductSkuService
{
    @Autowired
    private ProductSkuMapper productSkuMapper;

    /**
     * 查询商品库存
     * 
     * @param skuId 商品库存主键
     * @return 商品库存
     */
    @Override
    public ProductSku selectProductSkuBySkuId(Integer skuId)
    {
        return productSkuMapper.selectProductSkuBySkuId(skuId);
    }

    /**
     * 查询商品库存列表
     * 
     * @param productSku 商品库存
     * @return 商品库存
     */
    @Override
    public List<ProductSku> selectProductSkuList(ProductSku productSku)
    {
        return productSkuMapper.selectProductSkuList(productSku);
    }

    /**
     * 新增商品库存
     * 
     * @param productSku 商品库存
     * @return 结果
     */
    @Override
    public int insertProductSku(ProductSku productSku)
    {
        return productSkuMapper.insertProductSku(productSku);
    }

    /**
     * 修改商品库存
     * 
     * @param productSku 商品库存
     * @return 结果
     */
    @Override
    public int updateProductSku(ProductSku productSku)
    {

        return productSkuMapper.updateProductSku(productSku);
    }

    /**
     * 批量删除商品库存
     * 
     * @param skuIds 需要删除的商品库存主键
     * @return 结果
     */
    @Override
    public int deleteProductSkuBySkuIds(String skuIds)
    {
        return productSkuMapper.deleteProductSkuBySkuIds(Convert.toStrArray(skuIds));
    }

    /**
     * 删除商品库存信息
     * 
     * @param skuId 商品库存主键
     * @return 结果
     */
    @Override
    public int deleteProductSkuBySkuId(Integer skuId)
    {
        return productSkuMapper.deleteProductSkuBySkuId(skuId);
    }

    @Override
    public Integer selectCountByProductId(Integer productId) {
       return productSkuMapper.selectCountByProductId(productId);

    }
}
